package com.ym.domain.model;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.gitee.sunchenbin.mybatis.actable.annotation.*;
import com.gitee.sunchenbin.mybatis.actable.constants.MySqlTypeConstant;
import lombok.Data;

import javax.persistence.Column;
import javax.persistence.Table;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;

@Data
@Table
@TableComment("域名表")
public class DmDomain {

    // 销售状态：0-导入完毕,40-手工下架,50-销售中, 100-已销售, 110-线下销售, 111-取消交易, 112-已转出第三方, 150-第三方已售
    public static final short SALE_STATUS_IMPORTED = 0;
    public static final short SALE_STATUS_OFFLINE = 40;
    public static final short SALE_STATUS_ON_SALE = 50;
    public static final short SALE_STATUS_SOLD = 100;
    public static final short SALE_STATUS_OFFLINE_SALE = 110;
    public static final short SALE_STATUS_CANCEL_TRANSACTION = 111;
    public static final short SALE_STATUS_TRANSFER_OUT = 112;
    public static final short SALE_STATUS_SOLD_OTHER = 150;


    @Column
    @TableId(type = IdType.ASSIGN_ID)
    @IsKey
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    @Column(length = 20)
    @ColumnComment("注册商")
    private String registrar;

    @Column
    @ColumnComment("销售状态")
    private Short saleStatus;

    @Column(length = 255)
    @ColumnComment("域名")
    @Unique
    private String domain;

    @Column(length = 30)
    @ColumnComment("主域名")
    private String mainDomain;

    @Column(length = 30)
    @ColumnComment("域名后缀")
    private String domainSuffix;

    @Column
    @ColumnType(value = MySqlTypeConstant.DECIMAL, length = 18, decimalLength = 2)
    @ColumnComment("零售价")
    private BigDecimal retailPrice;

    @Column
    @ColumnType(value = MySqlTypeConstant.DECIMAL, length = 18, decimalLength = 2)
    @ColumnComment("成本")
    private BigDecimal cost;

    @Column
    @ColumnType(value = MySqlTypeConstant.DECIMAL, length = 18, decimalLength = 2)
    @ColumnComment("利润")
    private BigDecimal profit;

    @Column
    @ColumnComment("域名持有人ID")
    private Integer domainHolder;


    /**
     * 来源类型(1-一口价，2-预定/竞价, 10-新注册，11-第三方转入，999-其它)
     */
    @Column
    @ColumnComment("来源类型")
    private Short sourceType;

    /**
     * 子来源类型：
     * 一口价：（1-自有，2-供应商，3-第三方，4-竞价）
     * 预定：没有子来源类型
     */
    @Column
    @ColumnComment("子来源类型")
    private Short subSourceType;

    @Column
    @ColumnComment("域名长度")
    private Short domainLen;

    @Column
    @ColumnComment("是否备案")
    private Boolean isRecorded;

    @Column(length = 50)
    @ColumnComment("主备案号")
    private String mainRecordNum;

    @Column(length = 50)
    @ColumnComment("域名备案号")
    private String subRecordNum;

    @Column(length = 50)
    @ColumnComment("备案主办单位性质")
    private String recordType;

    @Column(length = 5)
    @ColumnComment("备案省份")
    private String registeredProvince;

    @Column
    @ColumnComment("备案日期")
    private LocalDate recordDate;

    @Column(length = 100)
    @ColumnComment("主办单位名称")
    private String companyName;

    @Column
    @ColumnComment("备案主体数量")
    private Integer companyRecordNum;

    @Column
    @ColumnComment("备案信息查询时间")
    private LocalDateTime recordQueryTime;

    @Column(length = 50)
    @ColumnComment("Whois-注册商IANA ID")
    private String registrarIanaNumber;

    @Column(length = 100)
    @ColumnComment("Whois-注册商IANA名称")
    private String registrarIanaName;

    @Column
    @ColumnComment("Whois-注册到期时间")
    private LocalDateTime registrationExpireTime;

    @Column
    @ColumnComment("Whois-域名注册时间")
    private LocalDateTime registrationTime;

    @Column
    @ColumnComment("百度收录")
    private Long seoBaidu;

    @Column
    @ColumnComment("搜狗收录")
    private Long seoSogou;

    @Column
    @ColumnComment("是否被墙")
    private Boolean isBlocked;

    @Column
    @ColumnComment("是否被污染")
    private Boolean isPolluted;

    @Column
    @ColumnComment("上架时间")
    private LocalDate onlineDate;

    @Column
    @ColumnComment("下架时间")
    private LocalDate offlineDate;

    @Column(length = 100)
    @ColumnComment("备注")
    private String remark;

    /**
     * 定价方式（0-系统固定定价，1-系统规则定价，99-手工定价）
     */
    @Column
    @ColumnComment("定价方式")
    private Short pricingType;

    @Column
    @ColumnComment("定价时间")
    private LocalDateTime pricingTime;

    @Column
    @ColumnComment("实名状态(0-未实名，1-实名中，2-实名成功，3-实名失败)")
    private Short customerRealNameStatus;

    @Column
    @ColumnComment("续费状态(0-未续费,1-续费中)")
    private Short renewStatus;

    @Column
    @ColumnComment("转出状态(0-正常状态,1-转出中,2-转出完成)")
    private Short transferStatus;

    @Column
    @ColumnComment("聚名得标时间")
    private LocalDate jumingWinningDate;

    @Column
    @ColumnComment("锁状态(null或0-正常，1-锁定)")
    private Short lockStatus;

    @Column
    @ColumnComment("锁定时间")
    private LocalDateTime lockTime;

    @Column
    @ColumnComment("创建时间")
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @Column
    @ColumnComment("修改时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

}
